Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport #10646: Deduplicate path separator duplicates #10751

Closed
wants to merge 4 commits into from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Jan 14, 2025

Fixes #10645, a small Windows gotcha missed with #10546.

I really had to get into the weeds with this one. The assertOutputContains function was modifying the output (a test actual value) before comparision with the unmodified actual value. This change was not visible. I've added an assertOn function (that assertOutputContains calls) that takes a NeedleHaystack configuration for how the search, expectation and display are made. I had wanted to add a pilcrow for line endings but the terminal output is restricted to ASCII so I've marked line beginnings with ^ and line endings with $. The needle (the expected output fragment) is shown annotated this way as can the haystack (the output). The haystack is not shown annotated with line delimiters but can be.

The concatOutput function, I've renamed to lineBreaksToSpaces. There's more detail on the cabal-testsuite changes in the changelog entry. One benefit of using an .md extension for changelog.d/pr-10646.md is that typos are caught by CI.



This is an automatic backport of pull request #10646 done by [Mergify](https://mergify.com).

- Manually replace path separators before anything else
- Use pathSeparator instead of literal char
- Use isPathSeparator predicate

(cherry picked from commit d0bd687)

# Conflicts:
#	cabal-install-solver/src/Distribution/Solver/Types/ProjectConfigPath.hs
- Add else.project test
- Use normalizeWindowsOutput
- Add a changelog entry
- Update expectation
- Use concatOutput on needle
- Include output
- Align lines
- Show modified output
- Apply concatOutput to the needle
- Show start and end of lines with ASCII ^ and $h
- Can't print pilcrow so use grep char for marking end of line
- Marking the start of line distinguishes "expected" intro from its content too, same for "output"
- Use \n in multiline string expectation
- Add NeedleHaystack
- Add expectNeedleInHaystack field to NeedleHaystack
- Remove 3 assert*Contains functions
- Add TxContains record
- Apply the txBwd transformations before display
- Add displayHaystack field
- Switch to using <EOL> as the marker
- Sort language pragmas
- Use ++ rather than cons with reversals
- Rerun ParseErrorProvenance test
- Add doctests for single line strings
- Read exected multiline string from file
- Use lineBreaksToSpaces
- Add module Test.Cabal.NeedleHaystack
- Redo ConditionalAndImport with multiline expectations
- Add test of string expectation start and end marking
- Rename encodeLf and decodeLfMarkLines
- Rename original concatOutput to lineBreaksToSpaces
- Add assertOutputContainsWrapped
- Use multiline and wrapped assertions
- DedupUsingConfigFromComplex multiline assertion
- Remove redundant tests that fail on Windows
- Use normalizeWindowsOutput in ConditionalAndImport
- Forward conversion applied twice by mistake
- Easier diff when assertOn follows assertOutputContains
- Add readVerbatimFile
- Have readVerbatimFile read contents strictly
- Add normalizePathSeparator
- Don't modify path separator for URIs
- Don't normalize path with anything URI-like
- Normalize expected output
- Rename to normalizePathSeparators
- Add an explicit export list to NeedleHaystack
- Drop unlines . lines added trailing newline
- Show example of normalizePathSeparators
- Use local unsnoc definition to avoid CPP
- Define local unlines
- Satisfy fix-whitespace
- Don't use <EOL>
- Rename to delimitLines
- Rename the changelog with *.md extension
- Add a section on cabal-testsuite changes
- Rename the function to readFileVerbatim
- Add to contributing and cabal-testsuite's readme
- Use setup for the noun
- Typo s/displaying/display
- Typo "can easier"
- Use unsnoc from Cabal-syntax Utils.Generic
- Add a note [Multiline Needles]
- Remove doctests available elsewhere
- Substitute encodeLf for concatOutput for assertOutputMatches

(cherry picked from commit 30f5d3f)

# Conflicts:
#	CONTRIBUTING.md
#	cabal-testsuite/cabal-testsuite.cabal
#	cabal-testsuite/src/Test/Cabal/Prelude.hs
(cherry picked from commit 484ac9c)

# Conflicts:
#	cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cabal.out
#	cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cabal.test.hs
- Add oops.expect.txt
- Add cabal-missing-package.expect.txt
- Add hops.expect.txt
- Add DedupUsingConfigFromComplex/errors.expect.txt
- Add using configuration from to errors.expect.txt

(cherry picked from commit 32b820b)
@mergify mergify bot added the conflicts label Jan 14, 2025
Copy link
Contributor Author

mergify bot commented Jan 14, 2025

Cherry-pick of d0bd687 has failed:

On branch mergify/bp/3.14/pr-10646
Your branch is up to date with 'origin/3.14'.

You are currently cherry-picking commit d0bd687a2.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   cabal-install-solver/src/Distribution/Solver/Types/ProjectConfigPath.hs

no changes added to commit (use "git add" and/or "git commit -a")

Cherry-pick of 30f5d3f has failed:

On branch mergify/bp/3.14/pr-10646
Your branch is ahead of 'origin/3.14' by 1 commit.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit 30f5d3f21.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/cabal.out
	new file:   cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/cabal.test.hs
	new file:   cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/dir-else/else.config
	new file:   cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/else.project
	new file:   cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/msg.expect.txt
	modified:   cabal-testsuite/README.md
	new file:   cabal-testsuite/src/Test/Cabal/NeedleHaystack.hs
	new file:   changelog.d/pr-10646.md

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   CONTRIBUTING.md
	both modified:   cabal-testsuite/cabal-testsuite.cabal
	both modified:   cabal-testsuite/src/Test/Cabal/Prelude.hs

Cherry-pick of 484ac9c has failed:

On branch mergify/bp/3.14/pr-10646
Your branch is ahead of 'origin/3.14' by 2 commits.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit 484ac9cb0.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   cabal-testsuite/PackageTests/BuildDeps/InternalLibrary2/setup.test.hs
	modified:   cabal-testsuite/PackageTests/BuildDeps/InternalLibrary3/setup.test.hs
	modified:   cabal-testsuite/PackageTests/CheckSetup/setup.test.hs
	modified:   cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs
	modified:   cabal-testsuite/PackageTests/NewBuild/T4288/cabal.test.hs
	modified:   cabal-testsuite/PackageTests/Regression/T5409/use-different-versions-of-dependency-for-library-and-build-tool.test.hs

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	deleted by us:   cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cabal.out
	deleted by us:   cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cabal.test.hs

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify bot mentioned this pull request Jan 14, 2025
6 tasks
@mergify mergify bot added the backport label Jan 14, 2025
@Kleidukos
Copy link
Member

@Mergifyio refresh

Copy link
Contributor Author

mergify bot commented Jan 14, 2025

refresh

✅ Pull request refreshed

@Kleidukos
Copy link
Member

@Mergifyio rebase

Copy link
Contributor Author

mergify bot commented Jan 14, 2025

rebase

☑️ Nothing to do

  • -conflict [📌 rebase requirement]
  • -closed [📌 rebase requirement]
  • queue-position = -1 [📌 rebase requirement]
  • any of:
    • #commits > 1 [📌 rebase requirement]
    • #commits-behind > 0 [📌 rebase requirement]
    • -linear-history [📌 rebase requirement]

@Kleidukos Kleidukos closed this Jan 14, 2025
@Kleidukos Kleidukos deleted the mergify/bp/3.14/pr-10646 branch January 14, 2025 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants